﻿<Window x:Class="BadPaint.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="BadPaint" Height="425" Width="572" xmlns:my="clr-namespace:BadPaint"
        PreviewKeyDown="WindowPreviewKeyDown">
    
    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="180*" />
            <RowDefinition Height="5" />
            <RowDefinition Height="131*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <DockPanel VerticalAlignment="Stretch" Grid.Row="0" HorizontalAlignment="Stretch">
            <StackPanel HorizontalAlignment="Left" Name="stackPanel1" VerticalAlignment="Stretch" Width="100" DockPanel.Dock="Left" Background="Gray">
                <Rectangle Width="20" Height="20" Margin="10" Fill="White" Stroke="Black"  PreviewMouseLeftButtonDown="ShapePreviewMouseLeftButtonDown"/>
                <Ellipse Width="15" Height="15" Margin="10" Fill="White" Stroke="Black" PreviewMouseLeftButtonDown="ShapePreviewMouseLeftButtonDown"/>
                <Polygon Points="13,0 26,23 0,23" Height="22" Width="25" Margin="10" Fill="White" Stroke="Black" PreviewMouseLeftButtonDown="ShapePreviewMouseLeftButtonDown"/>
            </StackPanel>
            <StackPanel HorizontalAlignment="Left" Name="stackPanel2" VerticalAlignment="Stretch" Width="100" DockPanel.Dock="Right" Background="Gray">
                    <Rectangle Width="20" Height="20" Margin="5" Fill="Red" PreviewMouseLeftButtonDown="ColorPreviewMouseLeftButtonDown"/>
                    <Rectangle Width="20" Height="20" Margin="5" Fill="Orange" PreviewMouseLeftButtonDown="ColorPreviewMouseLeftButtonDown"/>                
                    <Rectangle Width="20" Height="20" Margin="5" Fill="Yellow" PreviewMouseLeftButtonDown="ColorPreviewMouseLeftButtonDown"/>                
                    <Rectangle Width="20" Height="20" Margin="5" Fill="Green" PreviewMouseLeftButtonDown="ColorPreviewMouseLeftButtonDown"/>
                    <Rectangle Width="20" Height="20" Margin="5" Fill="Blue" PreviewMouseLeftButtonDown="ColorPreviewMouseLeftButtonDown"/>
                    <Rectangle Width="20" Height="20" Margin="5" Fill="Indigo" PreviewMouseLeftButtonDown="ColorPreviewMouseLeftButtonDown"/>
                    <Rectangle Width="20" Height="20" Margin="5" Fill="Violet"  PreviewMouseLeftButtonDown="ColorPreviewMouseLeftButtonDown"/>
            </StackPanel>
            <Canvas HorizontalAlignment="Stretch" 
                    VerticalAlignment="Stretch"
                    Name="_canvas" 
                    Background="Black">
            </Canvas>
        </DockPanel>
        <GridSplitter ResizeDirection="Rows" HorizontalAlignment="Stretch" Height="5" Grid.Row="1" />
        
        <DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="2" Visibility="Visible">
            <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
                <Label FontSize="20">Selected Item:</Label>
                <TextBox Name="SelectedItemName" Width="200" TextChanged="SelectedItemName_TextChanged" FontSize="20" />
            </StackPanel>
            <DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" DockPanel.Dock="Bottom">
                <StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" DockPanel.Dock="Top">
                    <DockPanel HorizontalAlignment="Stretch">
                        <TextBlock MinWidth="75" DockPanel.Dock="Left" FontSize="20">Language:</TextBlock>
                        <ComboBox Text="Language" 
                              Name="_currentLanguage" 
                              MinWidth="200"
                              ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=my:MainWindow, AncestorLevel=1}, Path=LanguageNames}" 
                              DataContext="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=my:MainWindow, AncestorLevel=1}}" FontSize="20" />
                        <Button Content="Pause" Name="pauseOrResume" Width="75" DockPanel.Dock="Right" Click="pauseOrResume_Click" FontSize="20" />
                        <Button Width ="100" DockPanel.Dock="Right" Click="UpdateClick" Name="UpdateButton" Content="Run Code" FontSize="20"></Button>
                        <Button Content="Clear" Name="ClearButton" Width="75" Click="button1_Click" FontSize="20" />
                    </DockPanel>
                </StackPanel>
                <TextBox Name="_codeTextBox" AcceptsReturn="True" AcceptsTab="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"  
                     HorizontalAlignment="Stretch" VerticalAlignment="Stretch" FontSize="20" />
            </DockPanel>
        </DockPanel>

        <Canvas Grid.ColumnSpan="1" Grid.RowSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Name="TopCanvas" PreviewMouseMove="TopCanvasMouseMove" PreviewMouseLeftButtonUp="TopCanvasMouseUp">
        </Canvas>
    </Grid>
</Window>
